{template header}
<script src="static/bootstrap/js/utils.js"></script>
<link rel="stylesheet" href="static/calendar/js/calendar.css" />
<script type="text/javascript" charset="utf-8" src="static/calendar/calendar.php"></script>
<link rel="stylesheet" href="static/kindeditor/themes/default/default.css" />
<script charset="utf-8" src="static/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="static/kindeditor/lang/zh_CN.js"></script>
<style type="text/css">
    label{float: left;margin: auto 10px;}
</style>
<form class="form-horizontal" action="index.php?c=admin&a=groupActHandle" method="post" enctype="multipart/form-data">
    <div class="control-group">
        <label class="control-label">用户ID</label>
        <div class="controls">
            <input type="text" name="uid" value="{eval echo (isset($info['uid']) && $info['uid']) ? $info['uid'] : '175701'}"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">群ID</label>
        <div class="controls">
            <input type="text" name="gids[]" value="{$info['gid']}"/>
            <a href="javascript:void(0)" onclick="addGidInput()">+</a>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">同步至</label>
        <div id="gid_controls" class="controls">
            <input type="text" name="gids[]"/>
        </div>
    </div>
    <hr>
    
    
    <div class="control-group  pr" >
        <label class="control-label" for="inputauthor">封面图：</label>
        <div class="controls">
            {if $info['img']} <img width="100px" height="100px" src="{$info['img']}"/>{/if}
            <input type="file" name="img" />
            
            <input type="radio" name="system_img" value="http://hupu-run.hupucdn.com/ACT/a336f6011850bf2e315e9f9cab67662f.png">
            <img width="100" src="http://hupu-run.hupucdn.com/ACT/a336f6011850bf2e315e9f9cab67662f.png">
            
            <input type="radio" name="system_img" value="http://hupu-run.hupucdn.com/ACT/d8105aa62e0c6e3050d4482e009a297b.png">
            <img width="100" src="http://hupu-run.hupucdn.com/ACT/d8105aa62e0c6e3050d4482e009a297b.png">
            
            <input type="radio" name="system_img" value="http://hupu-run.hupucdn.com/ACT/2bc323dac243be4cb9a7af278017e72a.png">
            <img width="100" src="http://hupu-run.hupucdn.com/ACT/2bc323dac243be4cb9a7af278017e72a.png">
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="inputTiltle">活动主题：</label>
        <div class="controls">
            <input type="text" name='title' placeholder="请输入标题" value="{$info['title']}">
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="inputtag">城市：</label>
        <div class="controls">
            <input type="text" value="{$info['place']}" name="place"/>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">活动地址：</label>
        <div class="controls">
            <input type="text" name="address" value="{$info['address']}">
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="inputstarttime">开始时间：</label>
        <div class="controls">
            <input type="text" name="stime" readonly="readonly" id="starttimeid" value="{eval echo date('Y-m-d H:i:s', ($info['stime']>0?$info['stime']:time()+10800))}">
            <input name="starttimebtn" type="button" id="starttimebtn" onclick="return showCalendar('starttimeid', '%Y-%m-%d %H:%M:%S', '24', false, 'starttimebtn');" value="选择" class="button" />
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="inputstarttime">结束时间：</label>
        <div class="controls">
            <input type="text" name="etime" readonly="readonly" id="endtimeid" value="{eval echo date('Y-m-d H:i:s', $info['etime']>0?$info['etime']:time()+14400)}">
            <input name="starttimebtn" type="button" id="endtimebtn" onclick="return showCalendar('endtimeid', '%Y-%m-%d %H:%M:%S', '24', false, 'starttimebtn');" value="选择" class="button" />
        </div>
    </div>
    
    <h2>活动类型</h2>
    <div class="control-group">
        <label class="control-label" for="inputShortDesc">乐活活动：</label>
        <div class="controls">
            <input type="radio" name="type" value="0">
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="inputShortDesc">里程活动：</label>
        <div class="controls">
            <input type="radio" name="type" value="1">
            里程（km）：
            <input type="text" name="target">
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" for="inputShortDesc">打卡活动：</label>
        <div class="controls">
            <input type="radio" name="type" value="2">
            天数：
            <input type="text" name="days">
            里程（km）：
            <input type="text" name="target2">
        </div>
    </div>
    
    
    <h2>报名设置</h2>
    <div class="control-group">
        <label class="control-label" for="inputtag">活动费用：</label>
        <div class="controls">
            <input type="text" name="free" value="{eval echo $info['cost'] ? floatval($info['cost']) : '0'}"/>元
        </div>
    </div>
    <div class="control-group">
        <label class="control-label" >谁可以参加：</label>
        <div class="controls">
            <select name="join">
                <option value="0">群内成员</option>
                <option value="1">任何人</option>
            </select>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">可参与人数（0表示不限制）
        <div class="controls">
            <input type="text" name="limit_member_max" value="{eval echo isset($info['limit_member_max']) ? $info['limit_member_max'] : '0'}">
        </div>
    </div>
    
    <h2>信息提交</h2>
    <div class="control-group">
        <div class="controls">
            是（默认包含姓名、手机、性别）
            <input type="radio" name="is_collect_info" value="1" >
            否
            <input type="radio" name="is_collect_info" value="0">
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">添加+1名称</label>
        <input type="text" name="collect_ext_name1"> 
    </div>
    <div class="control-group">
        <label class="control-label">添加+2名称</label>
        <input type="text" name="collect_ext_name2">
    </div>
    
    <div class="control-group">
        <label class="control-label" for="inputtag">活动详情：</label>
        <div class="controls">
            <textarea name="introduce">{$info['introduce']}</textarea>
        </div>
    </div>
    
    <div class="control-group">
        <div class="controls">
            <input type="hidden" name="action" value="update"/>
            <input type="hidden" name="id" value="{$info['aid']}"/>
            {if empty($info)}<button type="submit" class="btn">提交</button>{/if}
        </div>
    </div>
    
</form>

<script>
    var editor;
    KindEditor.ready(function(K) {
      editor = K.create('textarea[name="introduce"]', {
        allowFileManager : true,
        uploadJson: './index.php?c=admin&a=uploadKindEditorImg',
        newlineTag:'p',
        filterMode : true,
        htmlTags:{
          p : ['style','color', 'align'],
          font : ['style','color', 'size', 'face'],
          span : ['style','style','color', 'align'],
          div : ['style','class', 'align'],
          a : ['style','class', 'href', 'target', 'name'],
          embed : ['style','src', 'width', 'height', 'type', 'loop', 'autostart', 'quality',
          'style', 'align', 'allowscriptaccess', '/'],
          img : ['style','src', 'width', 'height', 'border', 'alt', 'title', 'align', 'style','data-source','/'],
          hr : ['style','class', '/'],
          br : ['/'],
          'p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : ['style','align'],
          'tbody,tr,strong,b,sub,sup,em,i,u,strike' : ['style'],
        }
      });
    });
    function addGidInput(){
        $('#gid_controls').append('<input type="text" name="gids[]"/>')
    }
</script>

{template footer}